﻿#include "StdAfx.h"			   //   ҉source file is Unicode҉	
#include "TkreseachMenuAction.h"
#include "ProMenubar.h"
#include "TestOffSet.h"
#include "TestSect.h"
#include "TestFeatTree.h"

namespace TkreseachMenuAction
{
	//菜单信息文件名
	ProFileName MsgFile = L"Tkreseach.txt";   

	//添加主菜单
	ProError AddMainMenu()
	{
		return ProMenubarMenuAdd("TkreseachMenubar","Tkreseach_Menubar","Utilities",PRO_B_TRUE,MsgFile);
	}

	ProError AddMenuButton0()
	{						
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button0_ac",(uiCmdCmdActFn)Button0Action,
			uiProeImmediate,uiAccessState_Button0,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button0",
			"Tkreseach_button0","Tkreseach_button0h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);

		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button0", "Tkreseach_button0h", "Tkreseach_button0h", MsgFile);

		return err;
	}
	ProError AddMenuButton1()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button1_ac",(uiCmdCmdActFn)Button1Action,
			uiProeImmediate,uiAccessState_Button1,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button1",
			"Tkreseach_button1","Tkreseach_button1h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button1", "Tkreseach_button1h", "Tkreseach_button1h", MsgFile);
		return err;
	}
	ProError AddMenuButton2()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button2_ac",(uiCmdCmdActFn)Button2Action,
			uiProeImmediate,uiAccessState_Button2,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button2",
			"Tkreseach_button2","Tkreseach_button2h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button2", "Tkreseach_button2h", "Tkreseach_button2h", MsgFile);
		return err;
	}
	ProError AddMenuButton3()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button3_ac",(uiCmdCmdActFn)Button3Action,
			uiProeImmediate,uiAccessState_Button3,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button3",
			"Tkreseach_button3","Tkreseach_button3h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button3", "Tkreseach_button3h", "Tkreseach_button3h", MsgFile);
		return err;
	}

	ProError AddMenuButton4()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button4_ac",(uiCmdCmdActFn)Button4Action,
			uiProeImmediate,uiAccessState_Button4,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button4",
			"Tkreseach_button4","Tkreseach_button4h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button4", "Tkreseach_button4h", "Tkreseach_button4h", MsgFile);
		return err;
	}
	ProError AddMenuButton5()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button5_ac",(uiCmdCmdActFn)Button5Action,
			uiProeImmediate,uiAccessState_Button5,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button5",
			"Tkreseach_button5","Tkreseach_button5h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button5", "Tkreseach_button5h", "Tkreseach_button5h", MsgFile);
		return err;
	}
	ProError AddMenuButton6()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button6_ac",(uiCmdCmdActFn)Button6Action,
			uiProeImmediate,uiAccessState_Button6,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button6",
			"Tkreseach_button6","Tkreseach_button6h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button6", "Tkreseach_button6h", "Tkreseach_button6h", MsgFile);
		return err;
	}
	ProError AddMenuButton7()
	{
		uiCmdCmdId ButtonId;
		ProError err(PRO_TK_NO_ERROR);
		err = ProCmdActionAdd("Tkreseach_button7_ac",(uiCmdCmdActFn)Button7Action,
			uiProeImmediate,uiAccessState_Button7,
			PRO_B_TRUE,PRO_B_TRUE,&ButtonId); 

		err = ProMenubarmenuPushbuttonAdd("TkreseachMenubar","Tkreseach_button7",
			"Tkreseach_button7","Tkreseach_button7h",NULL,
			PRO_B_TRUE,ButtonId,MsgFile);
		err = ProCmdIconSet (ButtonId, "button.gif");
		err = ProCmdDesignate (ButtonId, "Tkreseach_button7", "Tkreseach_button7h", "Tkreseach_button7h", MsgFile);
		return err;
	}

	int AddPopupMenu()
	{
		AddMainMenu();					//			 MainMenu

		AddMenuButton0();				//				|--Button0

		AddMenuButton1();				//				|--Button1

		AddMenuButton2();				//				|--Button2

		AddMenuButton3();				//				|--Button3

		AddMenuButton4();				//				|--Button4

		AddMenuButton5();				//				|--Button5

		AddMenuButton6();				//				|--Button6

		AddMenuButton7();				//				|--Button7




		return 0;
	}

	//0
	uiCmdAccessState uiAccessState_Button0( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button0Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		TestOffSet::test1();
		return 0;
	}
	//1
	uiCmdAccessState uiAccessState_Button1( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button1Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		TestOffSet::test2();
		return 0;
	}
	//2
	uiCmdAccessState uiAccessState_Button2( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button2Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		ProTestSectionMenuAction();
		return 0;
	}
	//3
	uiCmdAccessState uiAccessState_Button3( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button3Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		TestFeatTree::ProDemoGeneralCsysCreate();
		return 0;
	}
	//4
	uiCmdAccessState uiAccessState_Button4( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button4Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		TestFeatTree::ProDemoGeneralCsysCreateOtk();
		return 0;
	}
	//5
	uiCmdAccessState uiAccessState_Button5( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button5Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		//AfxMessageBox(L"Button5!");
		return 0;
	}
	//6
	uiCmdAccessState uiAccessState_Button6( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button6Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		//AfxMessageBox(L"Button6!");
		return 0;
	}
	//7
	uiCmdAccessState uiAccessState_Button7( uiCmdAccessMode access_mode )
	{
		return ACCESS_AVAILABLE;
	}

	int Button7Action( uiCmdCmdId command, uiCmdValue *p_value, void *p_push_command_data )
	{
		//AfxMessageBox(L"Button7!");
		return 0;
	}


};
